#include <utility_math.h>
#include <cstdio>

void drawScreen(const std::vector<std::vector<bool>> screen) {
    for (const auto& col : screen) {
        for (auto pixel : col) {
            if (pixel) {
                printf("# ");
            }
            else {
                printf("* ");
            }
        }
        printf("\n");
    }
}

void test_ddaLine() {
    int width = 40, height = 30;
    std::vector<std::vector<bool>> screen;
    screen.resize(height);
    for (int i = 0; i < height; ++i) {
        screen[i].resize(width);
    }

    Vec2f p1{ 0, 0 };
    Vec2f p2{ 29.0f, 0.0f };
    Vec2f p3{ 15, 24 };

    auto line = DDALine(p1, p2);

    for (auto point : line) {
        screen[point.second][point.first] = true;
    }

    auto line2 = DDALine(p2, p3);

    for (auto point : line2) {
        screen[point.second][point.first] = true;
    }
    
    auto line3 = DDALine(p3, p1);

    for (auto point : line3) {
        screen[point.second][point.first] = true;
    }

    float xMax = std::max({p1.x, p2.x, p3.x});
    float xMin = std::min({p1.x, p2.x, p3.x});

    drawScreen(screen);
}

int main() {
    test_ddaLine();
    return 0;
}
